package com.example.menuprincipal;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

public class menuPrincipal extends ListActivity {
	
	protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        String [] listas = new String []{"Lista Feira", "Sobre Android", "Contato","Sair"};
        ArrayAdapter<String> arrayAdapterListas = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, listas);
        setListAdapter(arrayAdapterListas);
}
	
	protected void onListItemClick(ListView l, View v, int position, long id){
		super.onListItemClick(l, v, position, id);		
		Object objetoSelecionado = this.getListAdapter().getItem(position);
		String menuSelecionado = objetoSelecionado.toString();
		Toast.makeText(this, "Menu Selecionado: " + menuSelecionado, Toast.LENGTH_LONG).show();
		
		switch(position){
		case 0:
			startActivity(new Intent(this, Listas.class)); break;
		case 1:
			startActivity(new Intent(this, Listas.class)); break;
		default: finish();
		}
	}

public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
}

}
